<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>js中的正则表达式</title>
		<script type="text/javascript">
			//年龄在0-130岁之间
			var reg = /^130$|^((1[0-2]|[1-9])?\d)$/;
			var age =15;
			document.write(reg.test(age));
			//检验网址是不是以http://或https：//开头
			//https://www.baidu.com
			var reg2=/^(https|http):\/\/.*/;
			var str = 'https://www.baidu.com';
			document.write('<br />');
			document.write(reg2.test(str));
			document.write('<br />');
			document.write(reg2.exec(str));
			//验证[A-z]区间
			document.write('<br />');
			var reg3 = /^[A-z]{6,}$/;
			var s = 'aSf_gssad';
			document.write(reg3.test(s));
			document.write('<br />');
			document.write(reg3.exec(s));
		</script>
	</head>
	<body>
	</body>
</html>
